package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/origin")
//解决跨域访问问题
@CrossOrigin("http://localhost:8081") //允许来自8081服务器发来的请求
public class CrossController {

    /**
     * 跨域访问方法
     * @return
     */
    @RequestMapping("/test1")
    @ResponseBody
    public String test1() {
        System.out.println("========访问到了跨域的controller方法===========");
        return "ok";
    }
}